import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl

numData=np.arange(0,10,0.01)
p1=plt.figure(figsize=(12,6),dpi=100)
mpl.rcParams['font.sans-serif'] = 'SimHei'  # 设置中文文本
mpl.rcParams['axes.unicode_minus'] = False  # 设置正常显示符号
mpl.rcParams['lines.linewidth'] = 1.5
mpl.rcParams['lines.linestyle'] = ':'
ax1=p1.add_subplot(2,1,1)
plt.title('y=x^2函数图像')
plt.plot(numData,numData ** 2,)

mpl.rcParams['lines.linestyle'] = '--'
mpl.rcParams['lines.linewidth'] = 3
ax2=p1.add_subplot(2,1,2)
plt.title('y=cos(x)函数图像')
plt.plot(numData,np.cos(numData)+1)

plt.show()